<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
//从上一页面点击row过来，传了row id 过来
//pageContext.setAttribute("_prePageListId",request.getParameter("_id"));
pageContext.setAttribute("_prePageListId",request.getParameter("_id")==null?"":request.getParameter("_id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>	
<script type="text/javascript">
var isIe = $.browser.msie;
var valueFilterNum = 0;

//定义全局变量记录分页信息  
var paramData = {  
 page:1,
 rows:60,
 sortOrder:'desc', 
 sortColumn:''
};  
var msgOut={};
</script>
<style type="text/css">
.condition{
	float:left; 
	height:25px;
	border:1px solid #fff;
}
.condition .mylabel{
	width:80px;
	float:left; 
	border:0px solid #fff;
}
.condition .myinput{
	width:150px;
	float:left; 
	border:0px solid #fff;
}
.condition .myfilter{
	width:200px;
	float:left; 
	border:0px solid #fff;
}

.clearboth{
	clear:both;
}

</style>
</head>

<%@taglib uri="/struts-tags" prefix="s" %>  
<body>
<div class="easyui-layout" data-options="fit:true"  id="conditionNorth" style="visibility:hidden;">
	<div data-options="region:'east'" style="width:100px;text-align:center; ">
		<div style="height: 2px;"></div>
		<a id='queryBtn_Filter' href='#' class='easyui-linkbutton' data-options="iconCls:'icon-search'" onclick='javascript:queryBtn_Filter();'>查询</a>
	</div>
	<div data-options="region:'center'" style="overflow:hidden;  padding-left: 3px;padding-top: 3px;">
		<div id="_conditionContentDiv" style="border: 0px solid red;">
			<script type="text/javascript">
				var columnPropertyArr = new Array();
				var columnPropertyTypeArr = new Array();
			</script>
			<#list conditionColumnMapList as column>
				<div class="condition">
					<#if column.columnType=='combotree'>
						<label class="mylabel">${column.columnShowName}：</label>
						<div class="myinput">
							<select id="${column.propertyName}"  name="${column.propertyName}" class="easyui-combotree" style="width:110px;"
									data-options="url:'${column.optionsPage}',editable:false">
							</select>
							<a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-no'" onclick="javascript:clearCombotree('${column.propertyName}')"></a>
						</div>
						<script type="text/javascript">
						columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}';
						columnPropertyTypeArr[columnPropertyTypeArr.length] = 'combotree';
						</script>
					<!-- check is select -->
					<#elseif column.columnType=='combobox'>
						<div class="item">
							<label class="mylabel">${column.columnShowName}：</label>
							<div class="myinput">
								<#if '${column.propertyName}'=='${foreignKey_PropertyFormat}'>
                                    <!-- 使用上一页面传过来的ID，作为查询条件，PS:查询一个公司下所有部门，在公司列表中右击查询，传_id，作为部门的外建
									s:if test="#parameters._id!=null && #column.propertyName.indexOf('_id')!=-1"
									-->
									<#if column.dataResource?exists && column.dataResource==2>
										<!-- 外键：动态通过SQL取值 -->
                                        <s:select
                                                id="${column.propertyName}"
                                                name="${column.propertyName}"
                                                value="%{#attr._prePageListId}"
                                                list="#attr._selectOptions4${column.propertyName}.list4condition"
                                                listKey="keyName"
                                                listValue="valueName"
                                                theme="simple"
                                                cssStyle="width:100px"
                                                data-options="editable:false"
                                                cssClass="easyui-combobox"/>
									<#elseif column.dataResource?exists && (column.dataResource==1||column.dataResource==4)>
                                        <!-- 外键：动态通过数据字典取值 -->
                                        <s:select
                                                id="${column.propertyName}"
                                                name="${column.propertyName}"
                                                value="%{#attr._prePageListId}"
                                                list="#attr._enumColumnSelfData.${column.propertyNameFirstWordUpper}4condition"
                                                listKey="keyName"
                                                listValue="valueName"
                                                theme="simple"
                                                cssStyle="width:100px"
                                                data-options="editable:false"
                                                cssClass="easyui-combobox"/>
									<#elseif column.dataResource?exists && column.dataResource==5>
                                        <!-- 外键：动态通过数据字典取值 -->
                                        <s:select
                                                id="${column.propertyName}"
                                                name="${column.propertyName}"
                                                value="%{#attr._prePageListId}"
                                                list="#attr._enumData.${column.propertyNameFirstWordUpper}4condition"
                                                listKey="keyName"
                                                listValue="valueName"
                                                theme="simple"
                                                cssStyle="width:100px"
                                                data-options="editable:false"
                                                cssClass="easyui-combobox"/>
									<#else>
                                        <!-- 外键：静态取值 -->
                                        <select id="${column.propertyName}"
                                                name="${column.propertyName}"
                                                style="width:100px"
                                                class="easyui-combobox"
                                                data-options="editable:false">
											<#list column.a1TemplateColumnOptionDtoList as optionItem>
                                                <option value="${optionItem.keyName}" <s:if test="#attr._prePageListId!=null && #attr._prePageListId=='${optionItem.keyName}'">selected=true</s:if>>${optionItem.valueName}</option>
											</#list>
                                        </select>
									</#if>

								<#else>
									<#if column.dataResource?exists && column.dataResource==2>
										<!-- 动态通过SQL取值 -->
										<s:select
												id="${column.propertyName}"
												name="${column.propertyName}"
												<#if column.defaultValue?exists>
                                                value="${column.defaultValue}"
												</#if>
												list="#attr._selectOptions4${column.propertyName}.list4condition"
												listKey="keyName"
												listValue="valueName"
												theme="simple"
												cssStyle="width:100px"
												data-options="editable:false"
												cssClass="easyui-combobox"/>
									<#elseif column.dataResource?exists && (column.dataResource==1||column.dataResource==4)>
										<!-- 数据字典取值 -->
                                        <s:select
                                                id="${column.propertyName}"
                                                name="${column.propertyName}"
												<#if column.defaultValue?exists>
												value="${column.defaultValue}"
												</#if>
                                                list="#attr._enumColumnSelfData.${column.propertyNameFirstWordUpper}4condition"
                                                listKey="keyName"
                                                listValue="valueName"
                                                theme="simple"
                                                cssStyle="width:100px"
                                                data-options="editable:false"
                                                cssClass="easyui-combobox"/>
									<#elseif column.dataResource?exists && column.dataResource==5>
										<!-- 数据字典取值 -->
                                        <s:select
                                                id="${column.propertyName}"
                                                name="${column.propertyName}"
												<#if column.defaultValue?exists>
                                                value="${column.defaultValue}"
												</#if>
                                                list="#attr._enumData.${column.propertyNameFirstWordUpper}4condition"
                                                listKey="keyName"
                                                listValue="valueName"
                                                theme="simple"
                                                cssStyle="width:100px"
                                                data-options="editable:false"
                                                cssClass="easyui-combobox"/>
									<#else>
										<select id="${column.propertyName}"
												name="${column.propertyName}"
												style="width:100px"
												class="easyui-combobox"
												data-options="editable:false">
											<#list column.a1TemplateColumnOptionDtoList as optionItem>
												<option value="${optionItem.keyName}"  <#if column.defaultValue?exists && column.defaultValue==optionItem.keyName>selected=true</#if>>${optionItem.valueName}</option>
											</#list>
										</select>
									</#if>
								</#if>
							</div>
							<script type="text/javascript">
							columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}';
							columnPropertyTypeArr[columnPropertyTypeArr.length] = 'combobox';
							</script>
						</div>
					<#elseif column.queryType=='between'>
						<#if column.columnType=='date' || column.columnType=='datetime'>
							<div class="dateitem">
								<!-- 日期范围 -->
								<label class="mylabel">${column.columnShowName}：</label>
								<div class="myinput">
									<input type="text" id="${column.propertyName}_Start" name="${column.propertyName}_Start" size='20'
										class='<#if column.columnType=='date'>easyui-datebox<#else >easyui-datetimebox</#if>'/>
                                    &nbsp;&nbsp;&nbsp;~
                                </div>
                                <div class="myinput">
									<input type="text" id="${column.propertyName}_End" name="${column.propertyName}_End" size='20'
										   class='<#if column.columnType=='date'>easyui-datebox<#else >easyui-datetimebox</#if>'/>
								</div>
								<script type="text/javascript">
								columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}_Start';
								columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}_End';
								columnPropertyTypeArr[columnPropertyTypeArr.length] = 'date';
								columnPropertyTypeArr[columnPropertyTypeArr.length] = 'date';
								</script>
							</div>
						<#elseif column.columnDbTypeLower=='int' || column.columnDbTypeLower=='long'|| column.columnDbTypeLower=='bigint'>
                            <div class="item">
                                <!-- int/long范围 -->
                                <label class="mylabel">${column.columnShowName}：</label>
                                <div class="myinput">
                                    <input type="text" id="${column.propertyName}_Start" name="${column.propertyName}_Start"/>
                                    &nbsp;&nbsp;&nbsp;~
                                </div>
                                <div class="myinput">
                                    <input type="text" id="${column.propertyName}_End" name="${column.propertyName}_End"/>
                                </div>
                                <script type="text/javascript">
                                    columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}_Start';
                                    columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}_End';
                                    columnPropertyTypeArr[columnPropertyTypeArr.length] = 'input';
                                    columnPropertyTypeArr[columnPropertyTypeArr.length] = 'input';
                                </script>
                            </div>
						</#if>
					<#elseif column.columnType=='date' || column.columnType=='datetime'>
						<div class="dateitem">
							<!-- 日期-->
							<label class="mylabel">${column.columnShowName}：</label>
							<div class="myinput">
								<input type="text" id="${column.propertyName}" name="${column.propertyName}" size='20'
									   class='<#if column.columnType=='date'>easyui-datebox<#else >easyui-datetimebox</#if>'/>
							</div>
							<script type="text/javascript">
								columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}';
								columnPropertyTypeArr[columnPropertyTypeArr.length] = 'date';
							</script>
						</div>
					<#else>
						<div class="item">
							<label class="mylabel">${column.columnShowName}：</label>
							<div class="myinput">
								<input type="text" id="${column.propertyName}" name="${column.propertyName}" placeholder="${column.queryTypePlaceholder}"/>
							</div>
							<script type="text/javascript">
							columnPropertyArr[columnPropertyArr.length] = '${column.propertyName}';
							columnPropertyTypeArr[columnPropertyTypeArr.length] = 'input';
							</script>
						</div>
					</#if>

				</div>
			</#list>
			
			<div class="clearboth"></div>
			<div style="height: 0px;"></div>
		</div>
	</div>
</div>			
</body>
</html>